﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Controls.Data.Input;
using System.ComponentModel.DataAnnotations;

namespace GranitePackageSystem.Models
{
    public class ADGroup
    {

        private string _groupName;
        private string _groupNotes;
        private string _groupDescription;
        private string _groupOwner;

        #region Group Name
        [Required(ErrorMessage = "AD Group Name Required")]
        [StringLength(64, MinimumLength = 10, ErrorMessage = "Group Name must be between 10 and 64 Characters")]
        [RegularExpression(@"[\w-\. ]*", ErrorMessage = @"Special characters are not allowed in the name.")]

        public string GroupName
        {
            get { return _groupName; }
            set
            {
                Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "GroupName"});
                _groupName = value;
            }
        }
        #endregion

        #region Group Notes
        [RegularExpression(@"[\w-\. ]*", ErrorMessage = @"Special characters are not allowed in the Notes.")]
        public string GroupNotes
        {
            get { return _groupNotes; }
            set
            {
                Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "GroupNotes" });
                _groupNotes = value;
            }
        }
        #endregion

        #region Group Description
        [RegularExpression(@"[\w-\. ]*", ErrorMessage = @"Special characters are not allowed in the Description.")]
        public string GroupDescription
        {
            get { return _groupDescription; }
            set
            {
                Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "GroupDescription" });
                _groupDescription = value;
            }
        }
        #endregion

        #region Group Owner
        [Required(ErrorMessage = "Must specify Owner of Group")]
        public string GroupOwner
        {
            get { return _groupOwner; }
            set
            {
                Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "GroupOwner" });
                _groupOwner = value;
            }
        }
        #endregion
    }

}
